import { request } from '../../../request/index.js'
Page({
  data: {
    id: '',
    science: {},
  },
  onLoad: function(options) {
    const token = wx.getStorageSync('token');
    this.setData({id: options.id});
    //获取文章详情信息
    request({
      url: '/petScience/info?id=' + options.id,
      method: 'GET',
      header: {
        'author': token ? token : '',
        'content-type': 'application/x-www-form-urlencoded' // 设置请求头为表单数据格式
      }
    }).then(res => {
      if (res.code === 0){
        this.setData({science: res.data})
        console.log(res.data);
      } else {
        wx.showToast({
          title: '未登录',
          icon: 'error'
        })
      }
    })
  }
});